<?php

use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;

class UserCaravanCalendar extends AbstractMigration
{
    public function up()
    {
        $users = $this->table('user_caravan_calendar', array('comment' => '会员房车详细状态表'));
        $users->addColumn('user_id', 'integer', array('null' => true))
              ->addColumn('caravan_id', 'integer')
              ->addIndex('caravan_id')
              ->addColumn('is_holiday', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 1))
              ->addColumn('shares', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 0))
              ->addColumn('rents', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 0))
              ->addColumn('wishs', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 0))
              ->addColumn('locks', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 0))
              ->addColumn('orders', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 0))
              ->addColumn('travel_money_base', 'integer', array('comment' => '旅行币基数', 'null' => true))
              ->addColumn('single_day_price', 'integer', array('comment' => '单日价格', 'null' => true))
              ->addColumn('datetimes', 'date')
              ->addColumn('created_at', 'timestamp', array('null' => true))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->save();     
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('user_caravan_calendar');
    }
}
